<?
include"../inc/config.inc.php";
if($_POST[MODE]=="ADD")
{
$level_id=$_POST[level_id];
$room_id=$_POST[room_id];
$room=$_POST[room];
$room_num=$_POST[room_num];
$teach_id=$_POST[teach_id];
$sql="insert into room(room_id,room,room_num,level_id,teach_id) values('$room_id','$room','$room_num','$level_id','$teach_id')";
mysql_query($sql) or die (mysql_error());
echo"<meta http-equiv='refresh' content='0;URL=room.php'>";
}
if($_GET[MODE]=="DEL")
{
$level_id=$_GET[level_id];
$room_id=$_GET[room_id];
$room=$_GET[room];
$room_num=$_GET[room_num];
$teach_id=$_GET[teach_id];
$sql="delete from room where room_id='$room_id'";
mysql_query($sql) or die (mysql_error());
echo"<meta http-equiv='refresh' content='0;URL=room.php'>";
}
if($_POST[MODE]=="EDIT")
{
$level_id=$_POST[level_id];
$room_id=$_POST[room_id];
$room=$_POST[room];
$room_num=$_POST[room_num];
$teach_id=$_POST[teach_id];
$sql="UPDATE room set room_id='$room_id',room='$room',room_num='$room_num',level_id='$level_id',teach_id='$teach_id' where room_id='$room_id'";
mysql_query($sql) or die (mysql_error());
echo"<meta http-equiv='refresh' content='0;URL=room.php'>";
}
?>